import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align: "center",
    dataIndex: 'projectId_dictText'
  },
  {
    title: '简历',
    align: "center",
    dataIndex: 'resumeId_dictText'
  },
  {
    title: '人员需求',
    align: "center",
    dataIndex: 'positionReqId_dictText'
  },
  {
    title: '锁定开始',
    align: "center",
    dataIndex: 'lockStart',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '锁定结束',
    align: "center",
    dataIndex: 'lockEnd',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '锁定人',
    align: "center",
    dataIndex: 'lockBy_dictText'
  },
  {
    title: '锁定状态',
    align: "center",
    dataIndex: 'lockStatus'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'projectId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_project,project_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目名称!'},
             ];
    },
  },
  {
    label: '简历',
    field: 'resumeId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_resume,real_name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入简历!'},
             ];
    },
  },
  {
    label: '人员需求',
    field: 'positionReqId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "tm_position_req,position_req_no,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入人员需求!'},
             ];
    },
  },
  {
    label: '锁定开始',
    field: 'lockStart',
    component: 'DatePicker',
  },
  {
    label: '锁定结束',
    field: 'lockEnd',
    component: 'DatePicker',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  projectId: {title: '项目名称',order: 0,view: 'sel_search', type: 'string',dictTable: "tm_project", dictCode: 'id', dictText: 'project_name',},
  resumeId: {title: '简历',order: 1,view: 'sel_search', type: 'string',dictTable: "tm_resume", dictCode: 'id', dictText: 'real_name',},
  positionReqId: {title: '人员需求',order: 2,view: 'sel_search', type: 'string',dictTable: "tm_position_req", dictCode: 'id', dictText: 'position_req_no',},
  lockStart: {title: '锁定开始',order: 3,view: 'date', type: 'string',},
  lockEnd: {title: '锁定结束',order: 4,view: 'date', type: 'string',},
  lockBy: {title: '锁定人',order: 5,view: 'sel_search', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  lockStatus: {title: '锁定状态',order: 6,view: 'text', type: 'string',},
};
